<?php

include_once 'db/Crud.php';

class Disciplina extends Crud {
    protected $table = "quesito";
    private $disciplina;
    private $idSerie;
    private $status;

    public function getStatus() {
        return $this->status;
    }

    public function setStatus($status) {
        $this->status = $status;
    }

    
    public function getDisciplina() {
        return $this->disciplina;
    }

    public function setDisciplina($disciplina) {
        $this->disciplina = $disciplina;
    }

    
    public function getIdSerie() {
        return $this->idSerie;
    }

    public function setIdSerie($idSerie) {
        $this->idSerie = $idSerie;
    }

    

    public function insert() {
        $sql = "INSERT INTO $this->table (que_disciplina, que_ser_id, que_status) VALUES (:disciplina, :idSerie, :status)";
        $stmt = Db::prepare($sql);
        $stmt->bindParam(':disciplina', $this->disciplina);
        $stmt->bindParam(':idSerie', $this->idSerie);
        $stmt->bindParam(':status', $this->status);
        return $stmt->execute();
        
    }

    public function update($id) {
        $sql = "UPDATE $this->table SET que_disciplina = :disciplina, que_ser_id = :idSerie, que_status = :status WHERE id = :id";
        $stmt = Db::prepare($sql);
        $stmt->bindParam(':disciplina', $this->disciplina);
        $stmt->bindParam(':idSerie', $this->idSerie);
        $stmt->bindParam(':status', $this->status);
        $stmt->bindParam(':id', $id);
        return $stmt->execute();
        
    }
    
    public function mostrardisciplina($id) {
        $sql = "SELECT * FROM $this->table WHERE que_ser_id =:id";
        $stmt = Db::prepare($sql);
        $stmt->bindParam(':id', $id);
        $stmt->execute();
        return $stmt->fetchAll(PDO::FETCH_CLASS);
        
    }


}
